package com.sample.action;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.zip.ZipInputStream;

import org.jbpm.JbpmConfiguration;
import org.jbpm.JbpmContext;
import org.jbpm.graph.def.ProcessDefinition;

public class DeploymentTest {

	public static void main(String[] args) throws IOException {
		JbpmContext jbpmContext = JbpmConfiguration.getInstance().createJbpmContext();
		
		try {
			String archiveFile = "d:/asynchronousprocess.zip";
			InputStream is = new FileInputStream(new File(archiveFile));
			ZipInputStream zis = new ZipInputStream(is);
			ProcessDefinition pd = ProcessDefinition.parseParZipInputStream(zis);
			
			jbpmContext.deployProcessDefinition(pd);
			
			zis.close();
			is.close();
		} finally {
			if (jbpmContext != null) {
				jbpmContext.close();
			}
		}
	}
	
}
